extends ../layout

block content
    h2.page-header 景点列表

    table.table.table-bordered
        thead
            tr
                th(width="30%")
                    if sortby === 'title'
                        if(sortdir === 'desc')
                            a(href="/admin/scenicIntroduction?page="+pageNum+"&sortby=title&sortdir=asc")
                                i.fa.fa-arrow-down &nbsp;标题
                        else
                            a(href="/admin/scenicIntroduction?page="+pageNum+"&sortby=title&sortdir=desc")
                                i.fa.fa-arrow-up &nbsp;标题
                    else
                        a(href="/admin/scenicIntroduction?page="+pageNum+"&sortby=title&sortdir=desc") 标题
                th
                    if sortby === 'created'
                        if(sortdir === 'desc')
                            a(href="/admin/scenicIntroduction?page=" + pageNum + "&sortby=created&sortdir=asc")
                                i.fa.fa-arrow-down &nbsp;创建时间
                        else
                            a(href="/admin/scenicIntroduction?page=" + pageNum + "&sortby=created&sortdir=desc")
                                i.fa.fa-arrow-up &nbsp;创建时间
                    else
                        a(href="/admin/scenicIntroduction?page=" + pageNum + "&sortby=created&sortdir=desc") 创建时间
                th
                    if sortby === 'favorite'
                        if(sortdir === 'desc')
                            a(href="/admin/scenicIntroduction?page=" + pageNum + "&sortby=favorite&sortdir=asc")
                                i.fa.fa-arrow-down &nbsp;点赞
                        else
                            a(href="/admin/scenicIntroduction?page=" + pageNum + "&sortby=favorite&sortdir=desc")
                                i.fa.fa-arrow-up &nbsp;点赞
                    else
                        a(href="/admin/scenicIntroduction?page=" + pageNum + "&sortby=favorite&sortdir=desc") 点赞
                th(width="90px")
                    if sortby === 'published'
                        if(sortdir === 'desc')
                            a(href="/admin/scenicIntroduction?page=" + pageNum + "&sortby=published&sortdir=asc")
                                i.fa.fa-arrow-down &nbsp;状态
                        else
                            a(href="/admin/scenicIntroduction?page=" + pageNum + "&sortby=published&sortdir=desc")
                                i.fa.fa-arrow-up &nbsp;状态
                    else
                        a(href="/admin/scenicIntroduction?page=" + pageNum + "&sortby=published&sortdir=desc") 状态

                th(width="80px")
                    if sortby === 'recommend'
                        if(sortdir === 'desc')
                            a(href="/admin/scenicIntroduction?page=" + pageNum + "&sortby=recommend&sortdir=asc")
                                i.fa.fa-arrow-down &nbsp;推荐
                        else
                            a(href="/admin/scenicIntroduction?page=" + pageNum + "&sortby=recommend&sortdir=desc")
                                i.fa.fa-arrow-up &nbsp;推荐
                    else
                        a(href="/admin/scenicIntroduction?page=" + pageNum + "&sortby=recommend&sortdir=desc") 推荐

                th(width="150px") 管理
        tbody
        each scenic in scenics
            tr
                td
                    a(href="/scenicIntroduction/view/",target="_blank")=scenic.title
                td= moment(scenic.created).format("YYYY-MM-DD HH:mm:ss")
                td= scenic.favorite || 0
                td
                    if scenic.published===true
                        a(href='/admin/scenicIntroduction/published/'+scenic.id+'/false')
                            span(class="label label-success",title="点击切换") 已发布
                    else
                        a(href='/admin/scenicIntroduction/published/'+scenic.id+'/true')
                            span(class="label label-default",title="点击切换") 未发布
                td
                    if scenic.recommend===true
                        a(href='/admin/scenicIntroduction/recommend/'+scenic.id+'/false')
                            span(class="label label-success",title="点击切换") 推荐
                    else
                        a(href='/admin/scenicIntroduction/recommend/'+scenic.id+'/true')
                            span(class="label label-default",title="点击切换") 普通
                td
                    a(href="/admin/scenicIntroduction/edit/"+scenic._id,class="btn btn-sm btn-default",target="_blank") 编辑
                    span &nbsp;&nbsp;
                    a(href="/admin/scenicIntroduction/delete/"+scenic._id,class="btn btn-sm btn-default") 删除

    if pageCount>1
        nav
            ul.pagination
                -var currentPage = 1
                while currentPage <= pageCount
                    if(currentPage === pageNum)
                        li.active
                            a(href="/admin/scenicIntroduction?page="+currentPage+"&sortby="+sortby+"&sortdir="+sortdir)= currentPage++
                    else
                        li
                            a(href="/admin/scenicIntroduction?page="+currentPage+"&sortby="+sortby+"&sortdir="+sortdir)= currentPage++
block scripts
    script $(function(){console.log('node Blog is ready')})
